#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>

class Point
{
public:
    Point(int x, inty) : m_x(x), m_y(y) {}

public:
    void display()
    {
        cout << "(" << m_x << "," << m_y<<")" << endl;
    }

public:
    int m_x;
    int m_y;
};

struct TreeNode
{
    int val;
    TreeNode *left;
    TreeNode *right;
    
};

int main()
{
#if 0
    /*类 定义 对象*/
    vector<int> myvec;

    /*数组容量*/
    cout << "capacity:" << myvec.capacity() << endl;

    /*添加数据*/
    myvec.push_back(11);
    myvec.push_back(22);
    myvec.push_back(33);
    myvec.push_back(44);
    myvec.push_back(55);

    /*数组元素个数 */
    cout << "size:" << myvec.size() << endl;

    /*数组容量*/
    cout << "capacity:" << myvec.capacity() << endl;

    /*at(idx):查看数组指定位置的值*/
    cout <<"at(1)"<< myvec.at(1)<<endl;
    /*[]:vector内部重载了[]运算符*/
    cout<< "myvec[2]:"<<myvec[2]<< endl;

    /*尾删*/
    myvec.pop_back();
    /*数组元素个数 */
    cout<< "size:"<<myvec.size()<< endl;
    for (int i = 0; i < myvec.size(); i++)
    {
        cout <<"at(i)"<< myvec.at(i)<<endl;
    }
    /*查看数组的首部元素*/
    cout<< "back:"<<myvec.back()<< endl;
    /*查看数组的尾部元素*/
    cout<< "front:"<<myvec.front()<< endl;
#endif

#if 0
    vector<string> myvec2;

    myvec2.push_back("laolv");
    myvec2.push_back("qiantao");
    myvec2.push_back("mingzhe");
    myvec2.push_back("fushao");

    for (int i = 0; i < myvec2.size(); i++)
    {
        cout << myvec2[i] << endl;
    }

    // 排序
    sort(myvec2.begin(), myvec2.end());

    // for (int i = 0; i < myvec2.size(); i++)
    // {
    //     for (int i = 1; i < myvec2.size(); i++)
    //     {
    //         if (myvec2[i] < myvec2[i - 1])
    //         {
    //             string tmp = myvec2[i];
    //             myvec2[i] = myvec2[i - 1];
    //             myvec2[i - 1] = tmp;
    //         }
    //     }
    // }
    for (int i = 0; i < myvec2.size(); i++)
    {
        cout << myvec2[i] << endl;
    }

#endif

#if 0

    vector<Point> myvec3;
    Point p1(3, 4);
    Point p2(33.44);
    Point p3(333, 444);

    myvec3.push_back(p1);
    myvec3.push_back(p2);
    myvec3.push_back(p3);

    for (int i = 0; i < myvec3.size(); i++)
    {
        myvec3[i].display();
    }

#endif

#if 1
    vector<vector<int>> myvec4;

    /*初始化vector方式*/
    vector<int> linel = {11, 22, 33, 44, 55};
    vector<int> linel = {111, 222, 333, 444, 555};
    vector<int> linel = {1111, 2222, 3333, 4444, 5555};
    vector<int> linel = {11111, 22222, 33333, 44444, 55555};

    myvec4.push_back(line1);
    myvec4.push_back(line2);
    myvec4.push_back(line3);
    myvec4.push_back(line4);

    for (int i = 0; i < myvec4.size(); i++)
    {
        for (int j = 0; j < myvec4[i].size(); j++)
        {
            myvec4[i][j]
        }
    }

#endif

    return 0;
}